package com.shxt;

import java.util.List;
import java.util.Map;

public class PageBean {
    public static Map<String , Object> serverMap(Map<String , Object> map,Object user,Integer pages) {
        String t = user.getClass().getSimpleName();
        String type = t.toLowerCase();
        map.put(type , user);
        
        map.put("number" , (pages-1)*6);
        
        return map;
    }

    
    
    public static Map<String , Object> map(Map<String , Object> map,Class<?> clazz,List<?> userList,Integer count,int pages ) {
        String name = clazz.getSimpleName().toLowerCase();

        int sumPage = (count%6==0)?count/6:((count/6)+1);
        if(sumPage==0){
            sumPage = 1;
        }
        //设定一个变量给分页
        int pp = sumPage%5==0?sumPage/5:(sumPage/5)+1;


        String listType = name+"List";
        map.put("pp" , pp);
        map.put(listType , userList);
        map.put("pages" , pages);
        map.put("sumPage",sumPage);
        
        
        
        return map;
    }


}
